{% extends "base.html" %}
{% from "security/_macros.html" import render_field_with_errors, render_field %}
{% block content %}

    <h1>Login</h1>
    <form class="form"
          action="{{ url_for_security('login') }}"
          method="POST"
          name="login_user_form">
        {{ login_user_form.hidden_tag() }}
        {{ login_user_form.csrf_token }}
        {{ wtf.form_errors(login_user_form, hiddens="only") }}

        {{ wtf.form_field(login_user_form.email) }}

        {{ wtf.form_field(login_user_form.password) }}
        {% if login_user_form.password.errors == ['No password is set for this user'] %}
            If your email account already exists, you may need to <a class="btn btn-primary" href="{{ url_for_security('send_confirmation') }}">Confirm your account</a> first.

            If you have already confirmed your email, you may need to <a class="btn btn-primary" href="{{ url_for_security('forgot_password') }}">Reset your password</a>.
        {% endif %}

        {{ wtf.form_field(login_user_form.remember) }}
        <div class="controls">
            {{ wtf.form_field(login_user_form.next) }}
            {{ wtf.form_field(login_user_form.submit, class='btn btn-primary') }}
        </div>
    </form>

    {% include "security/_menu.html" %}
{% endblock %}
